import Api from './api'

// 获取博客列表
export async function findBlogList(currentPage, pageSize) {
  let res = await Api.fetchBlogList(currentPage, pageSize)
  return res
}

// 查询首页分类列表博客最多前五条
export async function findTopType() {
  let res = await Api.fetchTopType()
  return res
}

// 查询首页标签列表博客最多前十二条
export async function findTopTag() {
  let res = await Api.fetchTopTag()
  return res
}

// 查询首页最新推荐博客列表前五条
export async function findRecommendList() {
  let res = await Api.fetchRecommendList()
  return res
}

// 查询博客搜索结果
export async function findSearchBlogList(currentPage, pageSize, search) {
  let res = await Api.fetchSearchBlogList(currentPage, pageSize, search)
  return res
}

// 查询博客、分类、标签总数统计
export async function findCountList() {
  let res = await Api.fetchCountList()
  return res
}

// 查询所有博客总字数
export async function findAllWordCount() {
  let res = await Api.fetchAllWordCount()
  return res
}

// 获取管理员信息
export async function findAdmin() {
  let res = await Api.fetchAdmin()
  return res
}

// 获取用户信息
export async function findUserMsg() {
  let res = await Api.fetchUserMsg()
  return res
}

// 获取分类列表
export async function findTypeList() {
  let res = await Api.fetchTypeList()
  return res
}

// 通过分类Id查询博客
export async function findBlogByTypeId(currentPage, pageSize, typeId) {
  let res = await Api.fetchBlogByTypeId(currentPage, pageSize, typeId)
  return res
}

// 获取标签列表
export async function findTagList(currentPage, pageSize) {
  let res = await Api.fetchTagList(currentPage, pageSize)
  return res
}

// 通过标签Id查询博客
export async function findBlogByTagId(currentPage, pageSize, tagId) { 
  let res = await Api.fetchBlogByTagId(currentPage, pageSize, tagId)
  return res
}

// 获取归档页面博客时间分组映射
export async function findArchivesBlogList() {
  let res = await Api.fetchArchivesBlogList()
  return res
}

// 查询所有已允许的友情链接
export async function findAllowedLinkList() {
  let res = await Api.fetchAllowedLinkList()
  return res
}

// 上传友情链接
export async function saveLink(link) {
  let res = await Api.saveLink(link)
  return res
}

// 根据博客Id查询博客详情信息
export async function findBlogDetail(id) {
  let res = await Api.fetchBlogDetail(id)
  return res
}

// 根据博客id更新博客评论数
export async function updateBlogComments(id, comments) {
  let res = await Api.updateBlogComments(id, comments)
  return res
}

export async function bangumiCalendar() {
  let res = await Api.bangumiCalendar()
  return res
}

export async function bangumiWatching() {
  let res = await Api.bangumiWatching()
  return res
}

//-----------------------------------------后台管理---------------------------------------------

// 登录验证
export async function profileLogin(username, password) {
  let res = await Api.profileLogin(username, password)
  return res
}

// 根据token查询用户
export async function findUserByToken() {
  let res = await Api.fetchUserByToken()
  return res
}

// 后台管理 查询博客列表
export async function findProBlogList(blogManageQueryVo) {
  let res = await Api.fetchProBlogList(blogManageQueryVo)
  return res
}

// 根据id查询博客
export async function findBlogById(id) {
  let res = await Api.fetchBlogById(id)
  return res
}

// 保存博客
export async function saveBlog(blog) {
  let res = await Api.saveBlog(blog)
  return res
}

// 更新博客
export async function updateBlog(blog) {
  let res = await Api.updateBlog(blog)
  return res
}

// 删除博客
export async function deleteBlog(id) {
  let res = await Api.deleteBlog(id)
  return res
}

// 根据id查询分类
export async function findTypeById(id) {
  let res = await Api.fetchTypeById(id)
  return res
}

// 保存分类
export async function saveType(type) {
  let res = await Api.saveType(type)
  return res
}

// 更新分类
export async function updateType(type) {
  let res = await Api.updateType(type)
  return res
}

// 删除分类
export async function deleteType(id) {
  let res = await Api.deleteType(id)
  return res
}

// 根据id查询标签
export async function findTagById(id) {
  let res = await Api.fetchTagById(id)
  return res
}

// 保存标签
export async function saveTag(type) {
  let res = await Api.saveTag(type)
  return res
}

// 更新标签
export async function updateTag(type) {
  let res = await Api.updateTag(type)
  return res
}

// 删除标签
export async function deleteTag(id) {
  let res = await Api.deleteTag(id)
  return res
}

// 查询轮播图
export async function findCarouselList() {
  let res = await Api.fetchCarouselList()
  return res
}

// 根据id查询轮播图
export async function findCarouselById(id) {
  let res = await Api.fetchCarouselById(id)
  return res
}

// 保存轮播图
export async function saveCarousel(carousel) {
  let res = await Api.saveCarousel(carousel)
  return res
}

// 更新轮播图
export async function updateCarousel(carousel) {
  let res = await Api.updateCarousel(carousel)
  return res
}

// 删除轮播图
export async function deleteCarousel(id) {
  let res = await Api.deleteCarousel(id)
  return res
}

// 查询所有友链
export async function findLinkList() {
  let res = await Api.fetchLinkList()
  return res
}

// 更新友链状态
export async function updateLink(link) {
  let res = await Api.updateLink(link)
  return res
}

// 删除友链
export async function deleteLink(id) {
  let res = await Api.deleteLink(id)
  return res
}